package com.m3958.firstgwt.client.datasource;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.m3958.firstgwt.client.constants.HmessageReceiverFieldConstants;
import com.m3958.firstgwt.shared.type.CommonField;
import com.m3958.firstgwt.shared.type.HmessageReceiverField;
import com.smartgwt.client.data.fields.DataSourceDateTimeField;
import com.smartgwt.client.data.fields.DataSourceTextField;

@Singleton
public class HmessageReceiverDataSource extends BaseDataSource{

    
    public static String className = "com.m3958.firstgwt.server.model.HmessageReceiver";

    @Inject
    public HmessageReceiverDataSource(DsErrorHandler deh,HmessageReceiverFieldConstants constants) {
    	setID("hmReceiverDS");
    	
    	
        DataSourceTextField statusField = new DataSourceTextField(CommonField.STATUS.getValue(),constants.status());
        DataSourceDateTimeField readTimeField = new DataSourceDateTimeField(HmessageReceiverField.READ_TIME.getValue(),constants.readTime());
        
        DataSourceTextField titleField = new DataSourceTextField(CommonField.TITLE.getValue(),constants.title());
        
        DataSourceTextField msgBodyField = new DataSourceTextField(HmessageReceiverField.MESSAGE.getValue(),constants.message());
        
        DataSourceTextField senderField = new DataSourceTextField(HmessageReceiverField.SENDER_NAME.getValue(),constants.senderName());
        
        addHandleErrorHandler(deh);
        
        setFields(getIdField(),getVersionField(),statusField,readTimeField,senderField,titleField,msgBodyField,getCreatedAtField(false,constants));
        setClientOnly(false);
       
    }

	@Override
	protected String getModelClassName() {
		return className;
	}   
}
